#include <bits/stdc++.h>

using namespace std;
using ll = long long;

string f[1010];

string get_max(string a, string b) {
    if (a.size() > b.size()) return a;
    else if (a.size() < b.size()) return b;
    else return a > b ? a : b;
}

void init() {
    f[1] = "1", f[2] = "2";
    for (int i = 3; i <= 1000; i++) {
        string a = "12", b = "21";
        int j = i - 3;
        while(j >= 3) {
            a += "12", b += "21";
            j -= 3;
        }

        if (j == 1) {
            f[i] = a + "1";
        } else if (j == 2) {
            f[i] = b + "2";
        } else {
            f[i] = get_max(a, b);
        }
    }
}

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    init();
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        cout << f[n] << endl;
    }
    return 0;
}